package com.itcast.demo;

import com.itcast.domain.User;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.util.List;

public class demo01 {
    public static void main(String[] args) throws IOException {
        SqlSession sqlSession = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("sql.xml")).openSession();
/**/
        List<User> all = sqlSession.selectList("com.itcast.mapper.UserMapper.findAll");
        System.out.println("all = " + all);
         sqlSession.update("com.itcast.mapper.UserMapper.update",12);


        sqlSession.commit();
        sqlSession.close();
    }

}
